//
//  NSDictionary+JRAdditions.m
//  EPBPro
//
//  Created by wucha on 2018/7/17.
//  Copyright © 2018年 fc. All rights reserved.
//

#import "NSDictionary+JRAdditions.h"

@implementation NSDictionary (JRAdditions)
- (NSDictionary *)dictionaryByReplacingNullsWithStrings {
    const NSMutableDictionary *replaced = [self mutableCopy];
    const id nul = [NSNull null];
    const NSString *blank = @"";

    
    for (NSString *key in self) {
        id object = [self objectForKey:key];
        if (object == nul) [replaced setObject:blank forKey:key];
        else if ([object isKindOfClass:[NSDictionary class]]) [replaced setObject:[object dictionaryByReplacingNullsWithStrings] forKey:key];
        
    }
    
    return [NSDictionary dictionaryWithDictionary:[replaced copy]];
    
}
@end
